<template>
    <div id="Home">
        <el-container class="ZCon">
            <el-header>
                <div class="headLogo">
                    <img src="../assets/images/tan.png" alt="">
                </div>
                <span class="headTitle">默鱼</span>
                <div class="search1">
                    <el-input placeholder="请输入内容" v-model="search1" class="input-with-select">
                        <el-button slot="append" icon="el-icon-search"></el-button>
                    </el-input>
                </div>
<!--                <span class="headQuit" @click="edit">退出</span>-->
                <div class="btn1">
                    <el-button type="text"><i class="el-icon-refresh-left"></i>刷新</el-button>
                    <el-button type="text"><i class="el-icon-user-solid"></i>管理员</el-button>
                    <el-button type="text"><i class="el-icon-close"></i></el-button>
                </div>
            </el-header>
            <el-container>

                <el-aside width="100px">

                    <div style="height:20px"></div>
                    <el-menu
                            :default-active="navStorage"
                            :router="true"
                            class="el-menu-vertical-demo">

                        <el-menu-item :index="item.path" @click="changeNavStorage(item.path)"  v-for="(item,index) in navList" :key="index">
                            <i :class=item.icon></i>
                            <span slot="title">{{item.title1}}</span>
                        </el-menu-item>

                    </el-menu>

                </el-aside>

                <el-main style="height: calc(100vh - 60px);overflow: auto">
                    <div>
                        <router-view></router-view>
                    </div>

                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
    export default {
        name: "Home",
        data(){
            return {
                search1 :"",
                navList:[
                    {
                        icon:"el-icon-s-home",
                        title1:"首页",
                        path:"Welcome"
                    },
                    {
                        icon:"el-icon-menu",
                        title1:"功能",
                        path:"Feature"
                    }
                ],
                onoff:false,
                navStorage:""
            }
        },
        created(){
            this.getNavList();
            this.navStorage = window.sessionStorage.getItem("navStorage");
        },
        methods:{
            changeNavStorage: function (n) {
                window.sessionStorage.setItem("navStorage", n);
                this.navStorage = n;
            },
            edit(){
                var onoff = confirm("你确定退出么？");
                if(onoff){
                    window.sessionStorage.clear();
                    this.$router.push("/");
                }else{
                    return false;
                }
            },
            async getNavList(){

                // var {data:res} = await this.$http.get("./navList.json");
                //
                // this.navList = res.data;
            },
            shrink(){
                this.onoff = !this.onoff
            }
        }
    }
</script>

<style scoped lang="less">
    #Home,.ZCon{
        height: 100%;
    }
    .el-header{
        background-color: rgb(28,50,89);

        .headLogo{
            display: inline-block;
            width: 48px;
            height: 48px;
            margin-top: 5px;
            border-radius: 50%;
            overflow: hidden;

            img{
                width: 100%;
            }

        }
        .headTitle{
            display: inline-block;
            margin-left: 20px;
            margin-top: 10px;
            font-size: 30px;
            color: #fff;
            vertical-align: top;
        }
        .search1{
            width: 300px;
            display: inline-block;
            position: relative;
            left: 20px;
            top: -20px;
        }

        .btn1{
            float: right;
            margin-right: 60px;
            margin-top: 10px;
            color: #fff;
            cursor: pointer;

            .el-button--text{
                color: #eee;
            }
        }
        /*.headQuit:hover{*/
        /*    color:red;*/
        /*}*/
    }
    .el-aside{
        background-color: rgb(24,43,75);

        .el-menu{
            border-right: 0;

            .el-menu-item{
                text-align: center;
                height: 90px;
                background-color:rgb(24,43,75);
                color: #eee;
                i {
                    padding-top: 15px;
                    display: block;
                    width: 60px !important;
                    height: 20px;
                    font-size: 30px !important;
                }
                a{
                    display: inline-block;
                    width: 100px;
                    height: 90px;
                    color: #fffdef;
                }
            }
            .is-active{
                background-color: rgb(64,118,243)!important;
                color: #eee !important;
            }
        }
        .shrink{
            text-align: center;
            font-size: 20px;
            color: #636363;
            background-color: #3d3d3d;
            i{
                cursor:pointer;
            }

        }
    }
    .el-main{
        background-color: rgb(11,26,55);
    }
</style>
